

descriptive_data <- 
  main_df %>% 
  select(player.age, pub_official_indicator, player.gender, player.ethnicity, player.education, player.religion, 
         player.province, group.dictator_payoff, player.vign_1, player.vign_2, player.vign_3) %>%
  mutate(male = (player.gender == 1)*1,
         javanese = (player.ethnicity == 1)*1,
         college_degree = (player.education == 4)*1,
         muslim = (player.religion == 1)*1,
         java_resident = (player.province %in% c(11, 12, 13, 14, 15, 16))*1,
         dictator_keep = case_when(pub_official_indicator == 1 ~ group.dictator_payoff,
                                   TRUE ~ NA_real_)) %>%
  select(age = player.age,
         male = player.gender,
         javanese,
         college_degree,
         muslim,
         java_resident,
         pub_official_indicator,
         dictator_keep,
         vignette_1 = player.vign_1,
         vignette_2 = player.vign_2,
         vignette_3 = player.vign_3
  )

stargazer(data.frame(descriptive_data), 
          type = "latex",
          title = "Descriptive Statistics",
          label = "desc",
          out = "./outputs/tables/table_a1.tex")

